<template>
	<view class="add">
		<view class="first" v-if="firstStep">
			<view class="photos">
				<view class="tit">
					<view class="left">
						<text>照片</text>
						<text>（最多3张）</text>
					</view>
					<view class="right">
						非必填
					</view>
				</view>
				<view class="">
					<!-- {{fileList1}} -->
					<!-- upload-text="上传附件" -->
					<u-upload :width="148" :height="148" maxCount="3" ref="uUpload" :show-progress="false"
						:action="`https://api-test.sixbg.com/oss/file/upload`" :auto-upload="true"
						@on-remove="onRemove1" :file-list="fileList1" @on-success="successUpload1"
						:form-data="{groupName :'coverImg'}">
					</u-upload>
				</view>
				<view class="open">
					是否公开
					<u-switch size="30" v-model="model.imagePublic" active-color="#0ecf79" inactive-color="#eee">
					</u-switch>
				</view>
			</view>

			<view class="info introBox">
				<view class="tit">
					客户简介
				</view>
				<view class="intro">
					<view style="height: 132rpx;">
						<u-input :maxlength="500" height="120"   :auto-height="false" v-model="model.brief"
							type="textarea"  />

					</view>
					<view class="max">
						{{model.brief.length}}/500
					</view>
				</view>

			<!-- 	<view class="open">
					<view class="openstatus">
						非隐私资料是否允许公开
						<u-switch size="30" v-model="model.dataPublic" active-color="#0ecf79" inactive-color="#eee">
						</u-switch>
					</view>
					<view class="tips">
						不会公开姓名、身份证号、手机号、微信号、住址等个人隐私信息
					</view>
				</view> -->

			</view>
			<view class="info" style="padding:24rpx 0 24rpx 24rpx;">
				<view class="tit">
					个人信息
				</view>
				<u-form :model="model" label-width="170" :rules="rules" ref="uForm" :errorType="errorType">
					<u-form-item  required :label-position="labelPosition" label="手机号" prop="mobile">
						<view class="writeInfo">
							<u-input maxlength="11" :border="border" placeholder="请输入手机号" v-model="model.mobile" type="number"></u-input>
						</view>
					</u-form-item>
					<u-form-item required :label-position="labelPosition" label="性别" prop="genderLable" >
						<view @click="actionGendersShow=true" class="line">
							<view  class="inp">
								<view class="inpCont">
									<text class="really" v-if="model.genderLable">{{model.genderLable}}</text>
									<text v-else class="please">请选择</text>
								</view>
							</view>
							<view class="more">
								<image src="https://oss.6mate.cn/mini/narrow.png" mode=""></image>
							</view>
						</view>
					</u-form-item>
					<u-form-item required :label-position="labelPosition" label="生日" prop="birthday">
						<view class="line">
							<view class="inp">
								<!-- {{endDate}}  {{pickerDate}}  {{startDate}} -->
								<gpp-date-picker @onCancel="onCancel" @onConfirm="onConfirm" :startDate="startDate"
									:endDate="endDate" :defaultValue="pickerDate">
									<view class="inpCont">

										<text class="really" v-if="model.birthday">{{model.birthday}}</text>
										<text v-else class="please">请选择</text>
									</view>
									<view class="more">
										<image src="https://oss.6mate.cn/mini/narrow.png" mode=""></image>
									</view>
								</gpp-date-picker>
							</view>
							
						</view>
					</u-form-item>


					<u-form-item required :label-position="labelPosition" label="目的类型">
						<view @click="actionintentionShow = true" class="line">
							<view  class="inp">
								<view class="inpCont">
									<text class="really" v-if="model.intentionLable">{{model.intentionLable}}</text>
									<text v-else class="please">请选择</text>
								</view>
							</view>
							<view class="more">
								<image src="https://oss.6mate.cn/mini/narrow.png" mode=""></image>
							</view>
						</view>
					</u-form-item>
					<u-form-item required :label-position="labelPosition" label="选择省市" prop="addr">
			
						<view  @click="addrshow = true" class="line">
				
							<view  class="inp">
								<view class="inpCont">
									<text class="really" v-if="model.addr">{{model.addr}}</text>
									<text v-else class="please">请选择</text>
								</view>
							</view>
							<view class="more">
								<image src="https://oss.6mate.cn/mini/narrow.png" mode=""></image>
							</view>
						</view>
					</u-form-item>
					<u-form-item :label-position="labelPosition" label="微信号">
						<view class="writeInfo">
						<u-input maxlength='20' :border="border" placeholder="请输入微信号" v-model="model.weiXin" type="text"></u-input>
						</view>
					</u-form-item>
					<u-form-item :label-position="labelPosition" label="名称">
						<view class="writeInfo">
						<u-input  maxlength='8' :border="border" placeholder="请输入名称" v-model="model.customerName" type="text">
						</u-input>
						</view>
					</u-form-item>
				<!-- 	<u-form-item :label-position="labelPosition" label="邮箱">
						<view class="writeInfo">
						<u-input :border="border" placeholder="请输入邮箱" v-model="model.email" type="text"></u-input>
						</view>
					</u-form-item> -->
					<u-form-item :label-position="labelPosition" label="学历">
						<view @click="actionEducationTypesShow=true" class="line">
							<view  class="inp">
								<view class="inpCont">
									<text class="really"
										v-if="model.educationTypeLable">{{model.educationTypeLable}}</text>
									<text v-else class="please">请选择</text>
								</view>
							</view>
							<view class="more">
								<image src="https://oss.6mate.cn/mini/narrow.png" mode=""></image>
							</view>
						</view>
					</u-form-item>
					<u-form-item :label-position="labelPosition" label="身高">
						<view @click="actionheightShow = true" class="line">
							<view  class="inp">
								<view class="inpCont">
									<text class="really"
										v-if="model.heightLable">{{model.heightLable}}</text>
									<text v-else class="please">请选择</text>
								</view>
							</view>
							<view class="more">
								<image src="https://oss.6mate.cn/mini/narrow.png" mode=""></image>
							</view>
						</view>
					</u-form-item>
					<u-form-item :label-position="labelPosition" label="体重">
						<view @click="actionweightShow = true" class="line">
							<view  class="inp">
								<view class="inpCont">
									<text class="really"
										v-if="model.weightLable">{{model.weightLable}}</text>
									<text v-else class="please">请选择</text>
								</view>
							</view>
							<view class="more">
								<image src="https://oss.6mate.cn/mini/narrow.png" mode=""></image>
							</view>
						</view>
					</u-form-item>
					<!-- <u-form-item :label-position="labelPosition" label="证件类型">
						<view @click="actioncertificateTypeLableShow=true" class="line">
							<view  class="inp">
								<view class="inpCont">
									<text class="really"
										v-if="model.certificateTypeLable">{{model.certificateTypeLable}}</text>
									<text v-else class="please">请选择</text>
								</view>
							</view>
							<view class="more">
								<image src="
https://oss.6mate.cn/mini/narrow.png" mode=""></image>
							</view>
						</view>
					</u-form-item>
					<u-form-item :label-position="labelPosition" label="证件号">
						<view class="writeInfo">
							<u-input :border="border" placeholder="请输入证件号" v-model="model.certificateNo" type="text">
							</u-input>
						</view>
						
					</u-form-item> -->

					<u-form-item :label-position="labelPosition" label="婚姻状况">
						<view @click="actionmarriageStateLableShow=true" class="line">
							<view  class="inp">
								<view class="inpCont">
									<text class="really"
										v-if="model.marriageStateLable">{{model.marriageStateLable}}</text>
									<text v-else class="please">请选择</text>
								</view>
							</view>
							<view class="more">
								<image src="https://oss.6mate.cn/mini/narrow.png" mode=""></image>
							</view>
						</view>
					</u-form-item>

					<u-form-item :label-position="labelPosition" label="月收入">
						<view @click="actionmonthIncomeShow=true" class="line">
							<view  class="inp">
								<view class="inpCont">
									<text class="really" v-if="model.monthIncomeLable">{{model.monthIncomeLable}}</text>
									<text v-else class="please">请选择</text>
								</view>
							</view>
							<view class="more">
								<image src="https://oss.6mate.cn/mini/narrow.png" mode=""></image>
							</view>
						</view>
					</u-form-item>

					
					<u-form-item :label-position="labelPosition" label="年收入">
						<view @click="actionyearIncomeShow=true" class="line">
							<view  class="inp">
								<view class="inpCont">
									<text class="really" v-if="model.yearIncomeLable">{{model.yearIncomeLable}}</text>
									<text v-else class="please">请选择</text>
								</view>
							</view>
							<view class="more">
								<image src="https://oss.6mate.cn/mini/narrow.png" mode=""></image>
							</view>
						</view>
					</u-form-item>

					<u-form-item :label-position="labelPosition" label="是否有房">
						<view @click="comSel('hasHouseLable')" class="line">
							<view  class="inp">
								<view class="inpCont">
									<text class="really" v-if="model.hasHouseLable">{{model.hasHouseLable}}</text>
									<text v-else class="please">请选择</text>
								</view>
							</view>
							<view class="more">
								<image src="https://oss.6mate.cn/mini/narrow.png" mode=""></image>
							</view>
						</view>
					</u-form-item>
					<u-form-item :label-position="labelPosition" label="是否有车">
						<view @click="comSel('hasCarLable')" class="line">
							<view  class="inp">
								<view class="inpCont">
									<text class="really" v-if="model.hasCarLable">{{model.hasCarLable}}</text>
									<text v-else class="please">请选择</text>
								</view>
							</view>
							<view class="more">
								<image src="https://oss.6mate.cn/mini/narrow.png" mode=""></image>
							</view>
						</view>
					</u-form-item>

					<u-form-item :label-position="labelPosition" label="是否有小孩">
						<view @click="comSel('hasChildLable')" class="line">
							<view  class="inp">
								<view class="inpCont">
									<text class="really" v-if="model.hasChildLable">{{model.hasChildLable}}</text>
									<text v-else class="please">请选择</text>
								</view>
							</view>
							<view class="more">
								<image src="https://oss.6mate.cn/mini/narrow.png" mode=""></image>
							</view>
						</view>
					</u-form-item>

					<u-form-item :label-position="labelPosition" label="是否有存款">
						<view @click="comSel('hasDepositLable')" class="line">
							<view  class="inp">
								<view class="inpCont">
									<text class="really" v-if="model.hasDepositLable">{{model.hasDepositLable}}</text>
									<text v-else class="please">请选择</text>
								</view>
							</view>
							<view class="more">
								<image src="https://oss.6mate.cn/mini/narrow.png" mode=""></image>
							</view>
						</view>
					</u-form-item>
					
					
					<u-form-item :label-position="labelPosition" label="职业"  >
						<view @click="actionallVocationsShow=true" class="line">
							<view  class="inp">
								<view class="inpCont">
									<text class="really" v-if="model.vocationLable">{{model.vocationLable}}</text>
									<text v-else class="please">请选择</text>
								</view>
							</view>
							<view class="more">
								<image src="https://oss.6mate.cn/mini/narrow.png" mode=""></image>
							</view>
						</view>
					</u-form-item>
					
					

					<!-- <u-form-item :label-position="labelPosition" label="职业">
						<view class="writeInfo">
						<u-input :border="border" placeholder="请输入职业" v-model="model.vocation" type="number">
						</u-input>
						</view>
					</u-form-item> -->

					<!-- <u-form-item :label-position="labelPosition" label="家庭成员">
						<view class="writeInfo">
						<u-input :border="border" placeholder="请输入家庭成员" v-model="model.family" type="number">
						</u-input>
						</view>
					</u-form-item>

					<u-form-item :label-position="labelPosition" label="性格">
						<view class="writeInfo">
							<u-input :border="border" placeholder="请输入性格" v-model="model.personality" type="number">
							</u-input>
						</view>
						
					</u-form-item>
 -->
					<view class="dif">
						<u-form-item label-position="top" label="红娘备注">

							<view class="intro" style="margin-top: 0; margin-right:24rpx;">
								<view style="height: 132rpx;">
									<u-input style="width: 100%;" :border="false" :maxlength="300" :height="120" :auto-height="false"
										v-model="model.userNote" type="textarea" />

								</view>
								<view class="max">
									{{model.userNote.length}}/300
								</view>
							</view>
						</u-form-item>
					</view>
				</u-form>
			</view>
			<view class="botBox">

				<view class="item1">
					<u-button shape="circle" type="error" @click="submit" :ripple="true" ripple-bg-color="#d7d8da">下一步
					</u-button>
				</view>
			</view>
		</view>
		<view v-else>
			<halfInfo :nextInfo="nextInfo" ref="halfInfoRef" @preStepFn="preStepFn" />
		</view>

		<u-select v-if="comShow" @confirm="comConfirm" v-model="comShow" :list="actionStatusList"></u-select>
		<u-select @confirm="marriageStateConfirm" v-model="actionmarriageStateLableShow"
			:list="actionmarriageStateList"></u-select>
		<u-select @confirm="certificateTypeLableConfirm" v-model="actioncertificateTypeLableShow"
			:list="actioncertificateTypeList"></u-select>
		<u-select v-model="addrshow" mode="mutil-column-auto" :list="addrList" @confirm="confirmAddr"></u-select>
		<u-select @confirm="educationTypeConfirm" v-model="actionEducationTypesShow" :list="actionEducationTypesList">
		</u-select>
		<u-select @confirm="heightConfirm" v-model="actionheightShow" :list="actionHeightList"></u-select>
		<u-select @confirm="weightConfirm" v-model="actionweightShow" :list="actionWeightList"></u-select>
		<!-- 目标类型 -->
		<u-select @confirm="intentionConfirm" v-model="actionintentionShow" :list="actionintentionList"></u-select>
		<!-- 性别 -->
		<u-select @confirm="GendersConfirm" v-model="actionGendersShow" :list="actionGendersList"></u-select>
		<!-- 月收入 -->
		<u-select @confirm="actionmonthIncomeConfirm" v-model="actionmonthIncomeShow" :list="actionmonthIncomeList"></u-select>
		<!-- 年收入 -->
		<u-select @confirm="actionyearIncomeConfirm" v-model="actionyearIncomeShow" :list="actionyearIncomeList"></u-select>
		<!-- 职业 -->
		
		<u-select @confirm="allVocationsConfirm" v-model="actionallVocationsShow" :list="allVocationsList"></u-select>
		
		
		
	</view>
</template>

<script>
	import halfInfo from '../components/halfInfo.vue'
	import dayjs from 'dayjs'
	import gppDatePicker from "@/components/gpp-datePicker/gpp-datePicker.vue"
	export default {

		data() {
			return {

				nextInfo: null,
				firstStep: true, //调试完记得放开
				// firstStep: false,
				action: 'https://api-test.sixbg.com/oss/file/upload',
				startDate: dayjs().subtract(60, 'year').format('YYYY-MM-DD'),
				endDate: dayjs().subtract(18, 'year').format('YYYY-MM-DD'),
				pickerDate: (dayjs().year() - 30) + '-' + (dayjs().month() + 1) + '-' + dayjs().date(),
				errorType: ['message', 'toast'],
				labelPosition: 'left',
				actionSheetShow: false,
				showDate: false,
				// 性别
				actionGendersShow: false,
				// 职业
				actionallVocationsShow: false,
				//月收入
				 actionmonthIncomeShow: false,
				 //年收入
				  actionyearIncomeShow: false,
				actionheightShow: false,
				actionweightShow: false,
				actionintentionShow: false,
				actionEducationTypesShow: false,
				actioncertificateTypeLableShow: false,
				actionmarriageStateLableShow: false,
				addrshow: false,
				comShow: false,
				model: {
					id: "",
					mobile: '', //手机号
					addr: "",
					storeId: '', //区域ID
					brief: '', //简短介绍
					imagePublic: false, //照片是否公开
					gender: '', //性别
					genderLable: '',
					birthday: '', //生日
					intentionLable: '',
					intention: '', //目的类型
					images: [], //照片列表
					// dataPublic: false, //非隐私资料是否公开
					weiXin: "", //微信号
					customerName: '', //名称
					// email: '', //邮箱
					educationTypeLable: '',
					educationType: '', //学历
					// certificateTypeLable: '',
					// certificateType: '', //证件类型
					// certificateNo: "", //证件号
					heightLable: '',
					height: '', //体重
					weightLable: '',
					weight: '', //体重
					marriageStateLable: "",
					marriageState: '', //婚姻状况
					monthIncome: '', //月收入(单位：元),
					monthIncomeLable: "",
					yearIncome: '', //年收入(单位：元)
					yearIncomeLable: "",
					hasHouseLable: '',
					hasHouse: "", //是否有房 0否，1是
					hasCarLable: "",
					hasCar: "", //是否有车 0否，1是
					hasChildLable: "",
					hasChild: "", //是否有小孩 0否，1是
					hasDepositLable: "",
					hasDeposit: "", //是是否有存款 0否，1是
					vocation: '', //职业
					vocationLable: "",
					// family: '', //家庭成员
					// personality: '', //性格
					userNote: '', //红娘备注
				},

				rules: {
					mobile: [{
							required: true,
							message: '请输入手机号',
							trigger: ['change', 'blur'],
						},
						{
							validator: (rule, value, callback) => {
								// 调用uView自带的js验证规则，详见：https://www.uviewui.com/js/test.html
								return this.$u.test.mobile(value);
							},
							message: '手机号码不正确',
							// 触发器可以同时用blur和change，二者之间用英文逗号隔开
							trigger: ['change', 'blur'],
						}
					],
					addr: [{
						required: true,
						message: '请选择选择省市',
						trigger: 'change'
					}],
					weiXin: [{
						required: true,
						message: '请输入微信号',
						trigger: 'blur',
					}],
					genderLable: [{
						required: true,
						message: '请选择性别',
						trigger: 'change'
					}],

					birthday: [{
						required: true,
						message: '请选择日期',
						trigger: 'change'
					}, ],
				},
				border: false,

				// actionSheetList: [{
				// 		value: 'MALE',
				// 		label: '男'
				// 	},
				// 	{
				// 		value: 'FEMALE',
				// 		label: '女'
				// 	}
				// ],
				actionStatusList: [],
				actionStatusList1: [{
						value: 0,
						label: '否'
					},
					{
						value: 1,
						label: '是'
					}
				],
				// 职业集合
				allVocationsList:[],
				actionGendersList: [],
				// 月收入
				actionmonthIncomeList: [],
				// 年收入
				actionyearIncomeList: [],
				actionHeightList: [],
				actionWeightList: [],
				actionintentionList: [],
				actionEducationTypesList: [],
				actioncertificateTypeList: [],
				actionmarriageStateList: [],
				addrList: [],
				checked: false,
				// fileList: [{
				// 	url: 'https://oss.6mate.cn/mini/Bill.png',
				// }],
				cur: '',
				fileList11: [],
				fileList1: [],
			}
		},
		computed: {
			borderCurrent() {
				return this.border ? 0 : 1;
			}
		},
		components: {
			gppDatePicker,
			halfInfo
		},
		onReady() {
			this.$refs.uForm.setRules(this.rules);
		},
		onLoad(e) {

			// 获取升高体重 
			this.getWeightHeightList()
			// 意图类型集合
			this.getactionintentionList()
			// 教育情况集合
			this.getallEducationTypes()
			// 查询所有授权区域列表
			this.getallMallAndStore()
			// 证件类型集合
			this.getallCertificateTypes()
			// 情感状态集合
			this.getallMarriageStates()
			// 性别集合
			this.getallGenders()
			//月年收入集合
			this.getallMonthIncomes()
			// 年收入集合
			this.getallYearIncomes()
			// 职业集合
			this.getallVocations()

			if (e?.id) {
				console.log(e.id, '我是id~~~~~~~~~~~~~~');
				uni.setNavigationBarTitle({
					title: '编辑客户'
				});


				this.$u.api.detailForUpdate({
						id: e.id
					})
					.then(res => {
						this.model = res.data
						this.model.addr = res?.data?.province + res?.data?.city
						this.fileList11 = res?.data?.images
						this.fileList1 = res?.data?.images?.map(r => {
							return {
								url: r
							}
						})
					});


			}

		},
		methods: {
			// 职业集合
			getallVocations() {
				this.$u.api.allVocations()
					.then(res => {
						this.allVocationsList = res.data?.map(r => {
							return {
								value: r.code,
								label: r.name
							}
						})
					});
			},
			
			// 性别集合
			getallGenders() {
				this.$u.api.allGenders()
					.then(res => {
						this.actionGendersList = res.data?.map(r => {
							return {
								value: r.code,
								label: r.name
							}
						})
						// this.comShow = true
					});
			},
			// 选择性别
			GendersConfirm(val){
				uni.hideKeyboard();
				this.model.genderLable = val[0].label;
				this.model.gender = val[0].value;
			},
			
			// 选择职业
			allVocationsConfirm(val){
				uni.hideKeyboard();
				this.model.vocationLable = val[0].label;
				this.model.vocation = val[0].value;
			},
			
			// 月年收入集合
			getallMonthIncomes() {
				this.$u.api.allMonthIncomes()
					.then(res => {
						this.actionmonthIncomeList = res.data?.map(r => {
							return {
								value: r.code,
								label: r.name
							}
						})
					});
			},
			// 选择月收入
			actionmonthIncomeConfirm(val){
				uni.hideKeyboard();
				this.model.monthIncomeLable = val[0].label;
				this.model.monthIncome = val[0].value;
			},
			// 年收入
			getallYearIncomes() {
			
				this.$u.api.allYearIncomes()
					.then(res => {
						this.actionyearIncomeList = res.data?.map(r => {
							return {
								value: r.code,
								label: r.name
							}
						})
					});
			},
			// 选择月收入
			actionyearIncomeConfirm(val){
				uni.hideKeyboard();
				this.model.yearIncomeLable = val[0].label;
				this.model.yearIncome = val[0].value;
			},

			preStepFn() {
				this.firstStep = true
				console.log(this.nextInfo, 44444);
				this.fileList1=this.nextInfo?.images?.map(r=>{
					return{
						url:r
					}
				})
			},

			successUpload1(data, index, lists) {
				let url = data.data;
				this.fileList11.push(url);
				this.model.images = JSON.parse(JSON.stringify(this.fileList11));
			},
			onRemove1(index) {
				this.fileList11.splice(index, 1);
				this.model.images = JSON.parse(JSON.stringify(this.fileList11))
			},

			// 是否想要孩子集合
			getallHopeHasChilds() {
				this.$u.api.allHopeHasChilds()
					.then(res => {
						this.actionStatusList = res.data?.map(r => {
							return {
								value: r.code,
								label: r.name
							}
						})
						this.comShow = true
					});
			},
			
			// 选择
			comSel(val) {
				this.cur = val

				// if (val == 'hasChildLable') {
				// 	// 是否有小孩
				// 	this.getallHopeHasChilds()
				// } else

				// if (val == 'genderLable') {
				// 	// 性别集合
				// 	this.getallGenders()
				// } 
				//  if (val == 'yearIncome') {
				// 	// 年收入集合
				// 	this.getallYearIncomes()
				// } else if (val == 'yearIncomeLable') {
				// 	// 年收入集合
				// 	this.getallYearIncomes()
				// } 
				// else if (val == 'monthIncomeLable') {
				// 	//月年收入集合
				// 	this.getallMonthIncomes()
				// } 
				// else {
				// 	this.actionStatusList = this.actionStatusList1
				// 	this.comShow = true
				// }
				
				this.actionStatusList = this.actionStatusList1
				this.comShow = true

			},
			
		
			comConfirm(val) {
				if (this.cur == 'hasHouseLable') {

					this.model.hasHouseLable = val[0].label;
					this.model.hasHouse = val[0].value;
				} else if (this.cur == 'hasCarLable') {
					this.model.hasCarLable = val[0].label;
					this.model.hasCar = val[0].value;
				} else if (this.cur == 'hasChildLable') {
					this.model.hasChildLable = val[0].label;
					this.model.hasChild = val[0].value;
				} else if (this.cur == 'hasDepositLable') {
					this.model.hasDepositLable = val[0].label;
					this.model.hasDeposit = val[0].value;
				}
				 
				//  else if (this.cur == 'genderLable') {
				// 	this.model.genderLable = val[0].label;
				// 	this.model.gender = val[0].value;
				// } else if (this.cur == 'yearIncomeLable') {
				// 	this.model.yearIncomeLable = val[0].label;
				// 	this.model.yearIncome = val[0].value;
				// } else if (this.cur == 'monthIncomeLable') {
				// 	this.model.monthIncomeLable = val[0].label;
				// 	this.model.monthIncome = val[0].value;
				// }


				console.log(val, 44444);
			},
			// 情感状态集合
			getallMarriageStates() {
				this.$u.api.allMarriageStates()
					.then(res => {
						this.actionmarriageStateList = res.data?.map(r => {
							return {
								value: r.code,
								label: r.name
							}
						})
					});
			},
			// 证件类型集合
			getallCertificateTypes() {

				this.$u.api.allCertificateTypes()
					.then(res => {
						this.actioncertificateTypeList = res.data?.map(r => {
							return {
								value: r.code,
								label: r.name
							}
						})
					});
			},
			// 查询所有授权区域列表
			getallMallAndStore() {
				this.$u.api.allMallAndStore()
					.then(res => {
						this.addrList = res.data?.map(item => ({
							value: item.provinceCode,
							label: item.province,
							children: item.storeList.map(store => ({
								value: store.id,
								label: store.city
							}))
						}));
					});
			},
			// 获取升高体重 
			getWeightHeightList() {

				for (let i = 129; i <= 211; i++) {
					this.actionHeightList.push({
						value: i,
						label: i + 'cm'
					})
				}

				for (let i = 30; i <= 130; i++) {
					this.actionWeightList.push({
						value: i,
						label: i + 'kg'
					})
				}

			},
			// 获取目的类型list
			getactionintentionList() {
				this.$u.api.allIntentions()
					.then(res => {
						this.actionintentionList = res.data?.map(r => {
							return {
								value: r.code,
								label: r.name
							}
						})
					});
			},
			getallEducationTypes() {
				this.$u.api.allEducationTypes()
					.then(res => {
						this.actionEducationTypesList = res.data?.map(r => {
							return {
								value: r.code,
								label: r.name
							}
						})
					});
			},

			onCancel(e) {
				console.log(e);
			},
			onConfirm(e) {
				this.model.birthday = e.dateValue;
			},

			submit() {
				let that = this

				let params = JSON.parse(JSON.stringify(this.model))
				this.$refs.uForm.validate(valid => {
					if (valid) {
						let params = JSON.parse(JSON.stringify(this.model))

						let {
							id,
							mobile,
							brief,
							gender,
							birthday,
							intention,
							images,
							weiXin,
							customerName,
							// email,
							educationType,
							// certificateType,
							// certificateNo,
							height,
							weight,
							marriageState,
							hasHouse,
							hasCar,
							hasChild,
							hasDeposit,
							vocation,
							// family,
							// personality,
							userNote,
							monthIncome,
							yearIncome

						} = params
						let paramsQuery = {};

						let jquery = {
							id,
							mobile,
							storeId: params.storeId,
							brief,
							gender,
							birthday,
							intention,
							images,
							// dataPublic: params.dataPublic ? 1 : 0,
							imagePublic: params.imagePublic ? 1 : 0,
							weiXin,
							customerName,
							// email,
							educationType,
							// certificateType,
							// certificateNo,
							height,
							weight,
							marriageState,
							yearIncome,
							monthIncome,
							// monthIncome,: monthIncome ? monthIncome * 1 : undefined,
							// yearIncome: yearIncome ? yearIncome * 1 : undefined,
							hasHouse,
							hasCar,
							hasChild,
							hasDeposit,
							vocation,
							// family,
							// personality,
							userNote
						}
						
						console.log(id,7777777777);

						if (id) {
							paramsQuery = {
								...jquery,
								id
							}
						} else {
							paramsQuery = {
								...jquery
							}
						}
						
						
						
						
					
					if (this.model.customerName ) {
						if((/^\d+$/.test(this.model.customerName))){
							that.$u.toast('名称不能为纯数字');
							return;
						}
						
					}
					
					let reg= /^[0-9a-zA-Z]*$/g
					if (this.model.weiXin && !reg.test(this.model.weiXin)) {
						that.$u.toast('微信号只能包含字母或数字');
						return;
					}
						
						// if (email && !that.$u.test.email(email)) {
						// 	that.$u.toast('邮箱格式不正确');
						// 	return;
						// }
						console.log(paramsQuery, 22338888);
						that.$u.api.addcustomer(paramsQuery)
							.then(res => {
								that.$u.toast(res.msg);
								if (res.code == 'ok') {
									that.firstStep = !that.firstStep

									this.nextInfo = res.data
									
									this.model.id = res?.data?.id

									setTimeout(() => {
										that.$refs.halfInfoRef.Fnopen()
									})

								}
								// console.log(res, 777777777);
							});
					} else {
						console.log('验证失败');
					}
				});
			},

			confirmAddr(e) {
				console.log(e);
				this.model.addr = e?. [0]?.label + e?. [1]?.label
				this.model.storeId = e?. [1]?.value
			},
			// 点击actionSheet回调
			// sexConfirm(val) {
			// 	console.log(val);

			// 	uni.hideKeyboard();
			// 	this.model.genderLable = val[0].label;
			// 	this.model.gender = val[0].value;
			// },
			heightConfirm(val) {
				uni.hideKeyboard();
				this.model.heightLable = val[0].label;
				this.model.height = val[0].value;
			},
			weightConfirm(val) {
				uni.hideKeyboard();
				this.model.weightLable = val[0].label;
				this.model.weight = val[0].value;
			},
			intentionConfirm(val) {
				uni.hideKeyboard();
				this.model.intentionLable = val[0].label;
				this.model.intention = val[0].value;
			},
			educationTypeConfirm(val) {
				this.model.educationTypeLable = val[0].label;
				this.model.educationType = val[0].value;
			},
			certificateTypeLableConfirm(val) {
				this.model.certificateTypeLable = val[0].label;
				this.model.certificateType = val[0].value;
			},
			marriageStateConfirm(val) {
				this.model.marriageStateLable = val[0].label;
				this.model.marriageState = val[0].value;
			},


			codeChange(text) {
				this.codeTips = text;
			},
			// 获取验证码
			getCode() {
				if (this.$refs.uCode.canGetCode) {
					// 模拟向后端请求验证码
					uni.showLoading({
						title: '正在获取验证码',
						mask: true
					})
					setTimeout(() => {
						uni.hideLoading();
						// 这里此提示会被this.start()方法中的提示覆盖
						this.$u.toast('验证码已发送');
						// 通知验证码组件内部开始倒计时
						this.$refs.uCode.start();
					}, 2000);
				} else {
					this.$u.toast('倒计时结束后再发送');
				}
			},
			errorChange(index) {
				if (index == 0) this.errorType = ['message'];
				if (index == 1) this.errorType = ['toast'];
				if (index == 2) this.errorType = ['border-bottom'];
				if (index == 3) this.errorType = ['border'];
			}

		}
	}
</script>
<style>
	page {
		background: #F6F6F6;
	}
</style>
<style scoped lang="scss">
	/deep/ .u-input__textarea{
		height: 66px !important;
		text-align: left !important; 
	}
	.add {
		padding: 24rpx 40rpx 120rpx;
		.writeInfo{
			padding-right: 24rpx;
		}
		/deep/ .u-input__textarea{
			height: 66px !important;
			text-align: left !important; 
		}
		/deep/ .u-form-item--left__content--required {
			margin-left: 10rpx !important;
		}
		/deep/ .u-form-item--left__content__label {
			padding-left: 10rpx !important;
		}
		.botBox {
			z-index: 9998;
			position: fixed;
			left: 40rpx;
			bottom: 90rpx;
			padding-bottom: env(safe-area-inset-bottom);
			right: 40rpx;
			.item1 {
				border-radius: 44rpx 44rpx 44rpx 44rpx;
				box-shadow: 0rpx 20rpx 24rpx 0rpx rgba(181, 36, 44, 0.2);
			}
		}
		.dif /deep/ .u-border-bottom:after {
			border-bottom-width: 0px !important;
		}
		/deep/ .u-input__input {
			text-align: right;
			// margin-right: 24rpx;
		}
		.btns1 {
			margin: 24rpx 68rpx;
			background: #FA4A53;
			box-shadow: 0rpx 20rpx 24rpx 0rpx rgba(181, 36, 44, 0.2);
			border-radius: 40rpx 40rpx 40rpx 40rpx;
		}

		.intro1 {
			height: 176rpx;
		}

		.intro {
			margin-top: 24rpx;
			padding: 6rpx 16rpx 0;

			background: #F1F1F1;
			border-radius: 10rpx 10rpx 10rpx 10rpx;



			.dif /deep/ .u-input__input {
				text-align: left !important;
				// margin-right: 24rpx;
			}

			.dif /deep/ textarea,
			.dif uni-textarea {
				height: 60px;
			}

			.max {
				font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
				font-weight: 400;
				font-size: 24rpx;
				color: rgba(15, 20, 23, 0.4);
				line-height: 28rpx;
				text-align: right;
				padding-bottom: 5rpx;
			}
		}

		.introBox {


			.open {
				margin-bottom: 24rpx;
				margin-top: 20rpx;

				.openstatus {
					display: flex;
					align-items: center;
					justify-content: space-between;
					font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
					font-weight: 400;
					font-size: 28rpx;
					color: #0F1417;
					line-height: 33rpx;

					text {}
				}

				.tips {
					font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
					font-weight: 400;
					font-size: 20rpx;
					color: rgba(15, 20, 23, 0.4);
					line-height: 23rpx;
					margin-top: 14rpx;
				}
			}

		}

		.please {
			font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
			font-weight: 400;
			font-size: 28rpx;
			color: #808080;
			line-height: 33rpx;
		}

		.really {
			font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
			font-weight: 500;
			font-size: 28rpx;
			color: #0F1417;
			line-height: 33rpx;
		}

		.line {
			flex: 1;
			display: flex;
			padding-right: 24rpx;

			.inp {
				flex: 1;
				.inpCont{
					width: 100%;  height: 35px; text-align: right;
				}
			}

			.more {
				image {
					width: 30rpx;
					height: 30rpx;
					margin-top: 21rpx;
				}
			}
		}


		/deep/ .u-form-item__message {
			text-align: right;
			margin-right: 24rpx;
		}

		/deep/ .u-form-item--left__content--required {
			// left: 88rpx;
		}

		.info {
			margin-bottom: 24rpx;
			padding: 24rpx;
			background: #FFFFFF;
			border-radius: 16rpx 16rpx 16rpx 16rpx;

			.tit {
				font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
				font-weight: 500;
				font-size: 36rpx;
				color: #0F1417;
				line-height: 42rpx;
			}
		}

		.photos {
			padding: 24rpx;
			background: #FFFFFF;
			border-radius: 16rpx 16rpx 16rpx 16rpx;
			margin-bottom: 24rpx;

			.open {
				margin-top: 16rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
				font-weight: 400;
				font-size: 28rpx;
				color: #0F1417;
				line-height: 33rpx;
			}

			.tit {
				margin-bottom: 18rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;

				.left {
					display: flex;
					align-items: center;

					>text:nth-child(1) {
						font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
						font-weight: 500;
						font-size: 28rpx;
						color: #0F1417;
						line-height: 40rpx;
					}

					>text:nth-child(2) {
						font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
						font-weight: 400;
						font-size: 24rpx;
						color: rgba(15, 20, 23, 0.4);
						line-height: 28rpx;
					}
				}

				.right {
					font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
					font-weight: 400;
					font-size: 24rpx;
					color: rgba(15, 20, 23, 0.4);
					line-height: 28rpx;
				}
			}
		}
	}
</style>
